package org.example.salesystem.controller;

import jakarta.servlet.http.HttpServletRequest;

import org.example.salesystem.entity.ResultBody;
import org.example.salesystem.utils.FileUploadUtil;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;


@RestController
@RequestMapping("/uploadfile")
@CrossOrigin(origins="*")
public class uploadfileController {
@RequestMapping("/file")
public ResultBody photo(MultipartFile file, HttpServletRequest request) {
    String s = FileUploadUtil.uploadFile(file);
    return new ResultBody(200, "文件上传成功", s);
}
}
